package com.sh.rabbitmq.config;


import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

@Slf4j
@Component
public class RabbitLister {

    @RabbitListener(queues = "QD")
    public void jiehsouD(Message msg, Channel channel){
        String s = new String(msg.getBody());
        log.info("当前时间{},收到消息:{}",new Date().toString(),s);
    }

    @RabbitListener(queues = "confirm.queue")
    public void jiehsouConfirm(Message msg, Channel channel){
        String s = new String(msg.getBody());
        log.info("当前时间{},收到消息:{}",new Date().toString(),s);
    }
}
